运行还原
-
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title></title>

  <style type="text/css">
    html, body {
      width: 100%;
      height: 100%;
      margin: 0;
      padding: 0;
      overflow: hidden;
    }

    #map {
      width: 100%;
      height: 100%;
    }
  </style>
</head>
<body>

<div id="map"></div>
<canvas id="canvas"></canvas>

<script type="text/javascript" src="//api.map.baidu.com/api?v=3.0&ak=baiduKey"></script>
<script type="text/javascript" src="../../js/mapv.js"></script>

<script type="text/javascript">

  // 百度地图API功能
  var map = new BMap.Map("map", {
    enableMapClick: false
  });    // 创建Map实例
  map.centerAndZoom(new BMap.Point(105.403119, 38.028658), 5);  // 初始化地图,设置中心点坐标和地图级别
  map.enableScrollWheelZoom(true); // 开启鼠标滚轮缩放

  map.setMapStyle({
    style: 'midnight'
  });

  var randomCount = 10;

  var data = [];

  var citys = ["北京","天津","上海","重庆","石家庄","太原","呼和浩特","哈尔滨","长春","沈阳","济南","南京","合肥","杭州","南昌","福州","郑州","武汉","长沙","广州","南宁","西安","银川","兰州","西宁","乌鲁木齐","成都","贵阳","昆明","拉萨","海口"];

  // 构造数据
  while (randomCount--) {
    var cityCenter1 = mapv.utilCityCenter.getCenterByCityName(citys[parseInt(Math.random() * citys.length)]);
    var cityCenter2 = mapv.utilCityCenter.getCenterByCityName(citys[parseInt(Math.random() * citys.length)]);
    var cityCenter3 = mapv.utilCityCenter.getCenterByCityName(citys[parseInt(Math.random() * citys.length)]);
    data.push({
      geometry: {
        type: 'Polygon',
        coordinates: [
          [[cityCenter1.lng - 1 + Math.random() * 1, cityCenter1.lat - 1 + Math.random() * 1], [cityCenter2.lng - 1 + Math.random() * 1, cityCenter2.lat - 1 + Math.random() * 1], [cityCenter3.lng - 1 + Math.random() * 1, cityCenter3.lat - 1 + Math.random() * 1]]
        ]
      },
      count: 30 * Math.random()
    });
  }

  var dataSet = new mapv.DataSet(data);

  var options = {
    gradient: {
      0: 'rgba(50, 50, 255, 0.8)',
      0.5: 'rgba(255, 255, 50, 0.8)',
      1: 'rgba(255, 55, 50, 0.8)'
    },
    max: 30,
    draw: 'intensity'
  }

  var mapvLayer = new mapv.baiduMapLayer(map, dataSet, options);
</script>

</body>
</html>

